package org.hank.compose_yyzs.http

import okhttp3.RequestBody
import org.hank.compose_yyzs.bean.BuildingBean
import org.hank.compose_yyzs.bean.BuildingStageData
import org.hank.compose_yyzs.bean.FloorStageData
import org.hank.compose_yyzs.bean.PageWrapper
import org.hank.compose_yyzs.bean.ProjectTreeNode
import org.hank.compose_yyzs.bean.UserInfo
import org.hank.compose_yyzs.bean.request.AppUserChangePwdDto
import org.hank.compose_yyzs.bean.request.LoginDto
import org.hank.compose_yyzs.bean.response.LoginResponse
import org.hank.compose_yyzs.http.bean.HttpWrapBean
import org.hank.compose_yyzs.bean.request.ProjectDto
import org.hank.compose_yyzs.bean.HomeProjectBean
import org.hank.compose_yyzs.bean.RoomBean
import org.hank.compose_yyzs.bean.UnitSimpleBean
import org.hank.compose_yyzs.bean.request.BuildingPagerRequest
import org.hank.compose_yyzs.bean.request.BuildingRoomsCountRequest
import org.hank.compose_yyzs.bean.request.FloorPagerRequest
import org.hank.compose_yyzs.bean.request.FloorRoomsCountRequest
import org.hank.compose_yyzs.bean.response.FloorPagerResponse
import org.hank.compose_yyzs.bean.response.ProjectRoomsCountResponse
import org.hank.compose_yyzs.bean.response.RoomTaskVo
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

//  ┏┓　　　┏┓
//┏┛┻━━━┛┻┓
//┃　　　　　　　┃
//┃　　　━　　　┃
//┃　┳┛　┗┳　┃
//┃　　　　　　　┃
//┃　　　┻　　　┃
//┃　　　　　　　┃
//┗━┓　　　┏━┛
//    ┃　　　┃                  神兽保佑
//    ┃　　　┃                  永无BUG！
//    ┃　　　┗━━━┓
//    ┃　　　　　　　┣┓
//    ┃　　　　　　　┏┛
//    ┗┓┓┏━┳┓┏┛
//      ┃┫┫　┃┫┫
//      ┗┻┛　┗┻┛
/**
 *@auth: Hank
 *邮箱: cs16xiaoc1@163.com
 *创建时间: 2023/8/17 16:19
 *描述: 定义网络接口请求
 */
interface ApiService {
    companion object{
        val url = "http://192.168.2.24:9002/"
    }

    @GET("user/login/obtainLoginKey")
    suspend fun getLoginKey(): HttpWrapBean<String>

    @POST("user/login/signIn")
    suspend fun login(@Body loginDot: LoginDto): HttpWrapBean<LoginResponse>

    @PUT("admin/user/password")
    suspend fun changePassword(@Body appUserChangePwdDto: AppUserChangePwdDto): HttpWrapBean<Any?>

    @GET("/admin/dept/tree")
    suspend fun getProjectTree():HttpWrapBean<MutableList<ProjectTreeNode>>

    @POST("building/project/page")
    suspend fun pageProject(@Body projectDto: ProjectDto): HttpWrapBean<PageWrapper<HomeProjectBean>>

    @POST("building/room/projectRoomCount")
    suspend fun getProjectRoomCount(@Body requestBody: RequestBody) : HttpWrapBean<MutableList<ProjectRoomsCountResponse>>

    @GET("admin/user/details/{userId}")
    suspend fun getUserInfo(@Path("userId") userId:Int): HttpWrapBean<UserInfo>

    @GET("admin/tenant/details/{id}")
    suspend fun getTenantNameById(@Path("id") tenant:String): HttpWrapBean<UserInfo>

    @POST("building/block/page")
    suspend fun getBuildingPager(@Body buildingPagerRequest: BuildingPagerRequest): HttpWrapBean<PageWrapper<BuildingBean>>

    @POST("building/room/blockRoomCount")
    suspend fun getBuildingRoomsCountByCode(@Body buildingRoomsCountRequest: BuildingRoomsCountRequest): HttpWrapBean<MutableList<BuildingStageData>>

    @GET("building/unit/page")
    suspend fun getUnitByBuildingNum(@Query("blockId") buildingNum:String):HttpWrapBean<MutableList<UnitSimpleBean>>

    @POST("building/floor/page")
    suspend fun getFloorPager(@Body request: FloorPagerRequest): HttpWrapBean<FloorPagerResponse>

    @POST("building/room/countFloorRoom")
    suspend fun getFloorRoomsCountByCode(@Body floorRoomsCountRequest: FloorRoomsCountRequest): HttpWrapBean<MutableList<FloorStageData>>

    @GET("building/room/listByFloorId")
    suspend fun getRoomsByFloorId(@Query("floorId") floorId:Long):HttpWrapBean<MutableList<RoomBean>>

    @GET("building/roomTask/getRoomTaskInfo")
    suspend fun getRoomTaskInfo(@Query("roomId") roomId: Long,
                                @Query("stageType") stageType: Int):HttpWrapBean<RoomTaskVo?>
}
